local sk__wuqin = fk.CreateSkill {

  name = "sk__wuqin",

  tags = {  },

}



sk__wuqin:addEffect(fk.EventPhaseStart, {
  name = "sk__wuqin",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__wuqin.name) and player.phase == Player.Finish and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local card = player.room:askForDiscard(player, 1, 1, false, sk__wuqin.name, true, ".|.|.|.|.|basic", "#sk__wuqin-invoke", true)
    if #card > 0 then
      event:setCostData(self, card)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:throwCard(event:getCostData(self), sk__wuqin.name, player, player)
    if player.dead then return end
    local choice = room:askForChoice(player, {"draw2", "sk__wuqin_2"}, sk__wuqin.name)
    if choice == "draw2" then
      player:drawCards(2, sk__wuqin.name)
    else
      player:gainAnExtraPhase(Player.Play)
    end
  end,
})

return sk__wuqin